<?php
/*
 * 验证基类
*/
namespace App\Validation;

use Phalcon\Validation;

class BaseValidation extends Validation
{	
	public function getData(){
		
		return json_decode(json_encode($this->_values));
	}

	//验证之前
	public function beforeValidation($data, $entity, $messages)
    {
        $data->p = property_exists($data,'p') ? $data->p : 1;
        $data->p = ($data->p >= 1) ? $data->p : 1;
		$data->page_num = property_exists($data,'page_num') ? $data->page_num : 20;
		$data->page_num = ($data->page_num >= 1) ? $data->page_num : 20;
		
        return true;
    }
}